Release 10.1A: OpenEdge Development:
ADM and SmartObjects
Invoking behavior in other linked objects
A SmartObject can execute internal procedures or functions in any SmartObject to which it is linked. This often is necessary to access special behavior or to facilitate communication between the SmartObjects. Accessing these internal procedures or functions does not require the SmartObjects to know each others’ procedure handles.
The ADM accomplishes this using the Progress
PUBLISH/SUBSCRIBEsyntax. Each SmartLink represents a set of named events. During the creation of a SmartLink, its source automatically subscribes to the named events in the target procedure, and vice versa. For example, the Navigation-Target subscribes to the named eventsfetchFirst,fetchNext,fetchPrev, andfetchLastin a SmartPanel Navigation-Source. When the application runs and a user presses the Next button, the SmartPanel executes the following statement, which sends a message to its Navigation-Target:
This syntax does not require the SmartPanel to keep track of which objects are its Navigation-Targets. Instead, the Progress interpreter tracks this using the
SUBSCRIBEstatements that theaddLinkprocedure executes on the Navigation-Target’s behalf. (The addLink procedure is executed when the SmartObjects are initialized.)The standard ADM code contains many such
PUBLISHstatements. Custom application code can also usePUBLISHstatements such as these to communicate between SmartObjects. For example, suppose that you use the addLink procedure as follows to add a SmartLink that is not recognized as one of the object’s supported links:
The
addLinkprocedure now executes the following statement:
The
h1procedure can now execute thePUBLISHstatement whenever it wants to invoke the named event inh2:
Each SmartObject includes properties for each link type. These properties, which have names composed of the link type followed by an event name, define the events to which an object is automatically subscribed by the addLink procedure. (See Table 3–2 through Table 3–7 for lists of source and target events.) You can modify these properties for your custom link types.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |